package la.iok.hzsvn.lewin.movie.operation.entity;

import java.util.Date;

import static la.iok.hzsvn.lewin.movie.core.model.PlayRecordVo.*;

/**
 * 播放记录，剧本的开本记录
 */
public class PlayRecord {
    /**
     * 系统自动结束时记录的结束者id
     */
    public static final Long TERMINATOR_ID_SYSTEM = -1L;
    public static final String TERMINATOR_SYSTEM = "系统";
    private Long id;
    /**
     * 剧本id,不是实例id
     */
    private Long movieId;
    /**
     * 剧本版本
     */
    private String movieVersion;
    /**
     * 剧本名称。冗余字段
     */
    private String movieName;
    /**
     * 开本的DM的id
     */
    private Long dmId;
    /**
     * DM账号，目前为手机号,冗余字段。
     */
    private String dmAccount;
    /**
     * 开本房间id
     */
    private Long roomId;
    /**
     * 房间名称。冗余字段。只记录开本时的值,开本后修改房间名称此处不更新
     */
    private String roomName;
    /**
     * 店铺id
     */
    private Long orgUnitId;
    /**
     * 店铺名称。冗余字段。只记录开本时的值,开本后修改店铺名称此处不更新
     */
    private String orgUnitName;
    /**
     * 开本设备id
     */
    private Long deviceId;
    /**
     * 开本设备名称
     */
    private String deviceName;
    /**
     * 状态
     */
    private Integer status;
    /**
     * 开本时间
     */
    private Date startTime;
    /**
     * 终止操作者的id.保存结束操作的用户id.如果是dm通过设备结束,也保存dm的id.如果是系统自动结束,则值为-1
     */
    private Long terminatorId;
    /**
     * 结束时间
     */
    private Date endTime;
    /**
     * 结束的类别。如果是通过设备结束,则为1,如果是用户结束,则为2,如果为系统定时结束则为3;
     */
    private int endType;
    /**
     * 开本的总金额,单位为分
     */
    private Integer cost;
    /**
     * 总金额减去优惠之后的实际支付金额
     */
    private Integer payAmount;
    /**
     * 总优惠金额，目前就是使用返利扣减的金额
     */
    private Integer luckyAmount;
    /**
     * 是否测试开本。测试开本不收费但是会显示水印
     */
    private Integer test;
    /**
     * 消费后房间账号剩余的账户余额
     */
    private Integer accountRemained;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMovieId() {
        return movieId;
    }

    public void setMovieId(Long movieId) {
        this.movieId = movieId;
    }

    public String getMovieVersion() {
        return movieVersion;
    }

    public void setMovieVersion(String movieVersion) {
        this.movieVersion = movieVersion;
    }

    public String getMovieName() {
        return movieName;
    }

    public void setMovieName(String movieName) {
        this.movieName = movieName;
    }

    public Long getDmId() {
        return dmId;
    }

    public void setDmId(Long dmId) {
        this.dmId = dmId;
    }

    public String getDmAccount() {
        return dmAccount;
    }

    public void setDmAccount(String dmAccount) {
        this.dmAccount = dmAccount;
    }

    public Long getRoomId() {
        return roomId;
    }

    public void setRoomId(Long roomId) {
        this.roomId = roomId;
    }

    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public Long getOrgUnitId() {
        return orgUnitId;
    }

    public void setOrgUnitId(Long orgUnitId) {
        this.orgUnitId = orgUnitId;
    }

    public String getOrgUnitName() {
        return orgUnitName;
    }

    public void setOrgUnitName(String orgUnitName) {
        this.orgUnitName = orgUnitName;
    }

    public Long getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(Long deviceId) {
        this.deviceId = deviceId;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Long getTerminatorId() {
        return terminatorId;
    }

    public void setTerminatorId(Long terminatorId) {
        this.terminatorId = terminatorId;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public int getEndType() {
        return endType;
    }

    public void setEndType(int endType) {
        this.endType = endType;
    }

    public Integer getCost() {
        return cost;
    }

    public void setCost(Integer cost) {
        this.cost = cost;
    }

    public Integer getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(Integer payAmount) {
        this.payAmount = payAmount;
    }

    public Integer getLuckyAmount() {
        return luckyAmount;
    }

    public void setLuckyAmount(Integer luckyAmount) {
        this.luckyAmount = luckyAmount;
    }

    public Integer getTest() {
        return test;
    }

    public void setTest(Integer test) {
        this.test = test;
    }

    public Integer getAccountRemained() {
        return accountRemained;
    }

    public void setAccountRemained(Integer accountRemained) {
        this.accountRemained = accountRemained;
    }

    /**
     * 是否正在播放中
     * @return 是播放中返回true,否则false
     */
    public boolean playing(){
        return status == STATUS_IN_PROGRESS;
    }

    /**
     * 正在结束播放
     * @return 正在结束播放返回true,否则false
     */
    public boolean ending(){
        return status == STATUS_ENDING;
    }

    /**
     * 是否已经结束
     * @return 已经结束返回true,否则false
     */
    public boolean ended(){
        return status == STATUS_ENDED;
    }
}
